package com.example.chat.service.impl;

import com.example.chat.model.MessageTemplate;
import com.example.chat.repository.MessageTemplateRepository;
import com.example.chat.service.MessageTemplateService;
import com.example.chat.type.MessageType;
import com.example.chat.type.PushMessageSystem;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class MessageTemplateServiceImpl implements MessageTemplateService {

    @Resource
    private MessageTemplateRepository messageTemplateRepository;


    @Override
    public MessageTemplate getMessageTemplate(MessageType messageType, PushMessageSystem pushMessageSystem) {
        //查询数据
        return  messageTemplateRepository.findTop1ByPushMessageSystemAndMessageType(pushMessageSystem, messageType);
    }
}